#include "dig_login.h"
#include "ui_dig_login.h"

Dig_Login::Dig_Login(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::Dig_Login)
{
    ui->setupUi(this);
}

Dig_Login::~Dig_Login()
{
    delete ui;
}

void Dig_Login::on_btn_login_clicked()
{
    int bookid = 0;
    int ret = Sql_Mgr::getInstance()->login(ui->le_user->text(), ui->le_password->text(), bookid);
    if(ret)
    {
        setResult(1);
        hide();
    }
    else
    {
        QMessageBox::information(nullptr, "信息","用户名或密码错误");
    }
}


void Dig_Login::on_btn_exit_clicked()
{
    setResult(0);
    hide();
}

